<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>搜索测试后台-添加关键字</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="${request.contextPath}/css/style.css">
	<script type="text/javascript" src="${request.contextPath}/js/jquery-1.6.1.min.js"></script>
	<script type="text/javascript" src="${request.contextPath}/js/main.js"></script>
	
	<script type="text/javascript">
	$(function(){
		
	});
	
	function listGoods(sts) {
		sts = sts && sts > -1 && sts < 3 && sts || 0;
		var kw = $('#keyWord').val();
		if(kw == null || kw == ''){
			alert('请输入关键字。');
			return;
		}
		var url = getUrl('tqueryWord');
		url += '?keyword=' + encodeURI(encodeURI(kw)) + '&status=' + sts + '&date=' + new Date().getTime();
		jQuery.ajax({
			type : 'POST',
			url : url,
			success : function(json) {
				if(json && json.length > 2) {
					var obj = eval(json)[0];
					var isNew = obj.isNewKey;
					var keyId = obj.keyId;
					var rs = obj.goods;
					if(isNew == 1 && keyId == ''){
						$('#isNew').fadeIn(0);
					}else{
						$('#isNew').fadeOut(0);
					}
					var h = '<ul style="margin-left:-10px;">';
					for(var i = 0, len = rs.length; i < len; i ++) {
						var o = rs[i];
						var title = o.goodsTitle;
						var gsn = o.goodsSn;
						var img = imgBase + o.img;
						h += '<li class="floatLi" style="height:170px;" id="'+gsn+'">' +
							 '	<img src="'+img+'" width="120" height="120" />' +
							 '	<div style="width:150px;height:55px;margin-top:10px;overflow:hidden;">'+title+'</div>' +
							 '	</div>' +
							 '</li>';
					}
					h += '</ul>';
					$('#div0').html(h);
				}else{
					alert('没有可显示的内容！');
				}
				$('#tab' + sts).addClass('tabOn');
				$('#tab' + sts).siblings("[id*=tab]").removeClass('tabOn');
			}
		});
	}
	
	function checkInput(){
		var v = $('#keyWord').val();
		try{
			if(v.trim().length > 0){
				return true;
			}
		}catch(e){
		}
		alert('请输入关键字！');
		return false;
	}
	</script>
  </head>
  
  <body>
  	
	<div class="mainDiv" style="text-align:left;">
		<form action="tdoSingleAdd" method="post" onsubmit="return checkInput();">
			<span style="font-weight:bold;font-size:25px;">关键字：</span>
			<input class="inputBox" type="text" style="height:30px;" size="30" value="" id="keyWord" name="keyword" /> 
			<span id="isNew" style="color:red;display:none;">新关键字</span>
			<input type="button" style="padding:5px;" value="搜索" onclick="listGoods();" /> 
			<input type="submit" style="padding:5px;" value="确认添加" /> 
		</form>
  		<table border="0" id="tabTable" style="width:980px;margin:20px auto auto auto;">
			<tr>
				<td width="20"></td>
				<td width="180" onclick="listGoods(0);" class="tabTd tabOn" id="tab0">未处理 </td>
				<td width="180" onclick="listGoods(1);" class="tabTd" id="tab1">正确 </td>
				<td width="180" onclick="listGoods(2);" class="tabTd" id="tab2">错误 </td>
				<td></td>
				<td></td>
				<td>&nbsp;
					<a class="link_" href="testIndex">首页</a>
					<a class="link_" href="tviewAdd">批量添加关键字</a>
				</td>
			</tr>
			<tr>
				<td width="20"></td>
				<td colspan="6">
					<div id="div0" class="containerDiv">
						
					</div>
				</td>
			</tr>
		</table>
  	</div>
  </body>
</html>
